import absSubAction from "../abssubcmdaction";
import globalConst from "../../../canvas/common/globalConst.js";
var global = globalConst.GlobalConst;
import {LGXEnums}  from "../../../canvas/common/sysenum";

import cmdenums from "../cmdenums";

class ScaleCMDAction extends absSubAction.AbsSubAction {
    constructor() {
        super();
        this.mainCMD = cmdenums.EditCmdType.scale;
    }

    actCanvasEvt(evt, mainctl) {
        let actRst = null;
        let coordDecs = evt.wx.toFixed(2) + "," + evt.wy.toFixed(2);
        if (evt.subEditModeState == 'start') {
            let cmd = new absSubAction.TCmd();
            cmd.type = 'edit_lmousedown';
            cmd.value = "";
            let nextTips = "输入缩放比例因子或鼠标按下确定缩放比例因子。取消（Esc）。使用当前位置(e)";
            let appendToPreCMD = coordDecs;
            actRst = { cmdObj: cmd, nextTips, appendToPreCMD };
        }
        else if (evt.subEditModeState == 'finish') {
            let cmd = new absSubAction.TCmd();
            cmd.type = 'end';
            cmd.value = "";
            let nextTips = "取消（Esc）。删除原图？（Y/N）";
            let appendToPreCMD = coordDecs;
            actRst = { cmdObj: cmd, nextTips, appendToPreCMD };
        }
        return actRst;
    }
}

export  { ScaleCMDAction }